﻿<!--BitAdmin2.0框架文件-->
<style type="text/css">
    .modal .panel-body {
        padding: 0;
    }
</style>
<link href="../../lib/bootstrap-treeview/bootstrap-treeview.min.css" rel="stylesheet" />

<div class="modal fade" id="pickerModal" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true" style="top: 30px">
    <div class="modal-dialog" style="width:400px;overflow-y:auto;">
        <div class="modal-content">
            <div class="panel panel-default" style="margin-bottom: 0; width:100%;">
                <div class="panel-heading">
                    模块选择
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                </div>
                <div class="panel-body">
                    <div class="panel-body">
                        <div id="moduleTree" data-url="../../picker/getModuleTreeData" data-text="moduleName" style="height:300px; overflow-y:auto"></div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" id="clear_input" class="btn btn-default">
                    <span class="glyphicon glyphicon-remove-circle"></span> 清空
                </button>
                <button type="button" id="close_module" class="btn btn-default" data-dismiss="modal">
                    <span class="glyphicon glyphicon-remove"></span> 关闭
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<script src="../../lib/bootstrap-treeview/bootstrap-treeview.min.js"></script>
<script type="text/javascript">
    $("#pickerModal").modal('hide');//防止重复点击
    $("#pickerModal").modal('show');
    var param = JSON.parse($("#pickerModal").parent().attr("data-param"));
    var valueInput = param.value;
    var textInput = param.text;

    $("#pickerModal #moduleTree").bitTree({
        onNodeSelected: function (event, node) {
            $(valueInput).val(node.moduleId);
            $(textInput).val(node.moduleName);
            $(textInput).change();
            $("#pickerModal").modal('hide');
        }
    }).load();

    $("#clear_input").click(function () {
        $(valueInput).val("");
        $(textInput).val("");
        $("#Module_module").modal('hide');
    });
</script>